import request from '@/utils/request'

export default {
  // 列表
  query(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/list`,
      method: 'post',
      data
    })
  },
  // 添加
  create(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/create`,
      method: 'post',
      data
    })
  },
  // 编辑
  edit(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/edit`,
      method: 'post',
      data
    })
  },
  // 详情
  detail(params) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/detail`,
      method: 'get',
      params
    })
  },
  // 批量提交
  batchSubmit(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/batch-submit`,
      method: 'post',
      data
    })
  },
  // 批量反审
  batchAuditBack(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/batch-audit-back`,
      method: 'post',
      data
    })
  },
  // 采购接收
  receive(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/batch-receive`,
      method: 'post',
      data,
      returnData: true
    })
  },
  // 批量审核
  batchAudit(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/batch-audit`,
      method: 'post',
      data
    })
  },
  // 取消
  remove(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/remove`,
      method: 'post',
      data
    })
  },
  // 作废/回退
  change_status(params) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/change-status`,
      method: 'get',
      params
    })
  },
  // 获取SKU数据
  getSku(params) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/get-sku`,
      method: 'get',
      params
    })
  },
  // 变更
  change(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/change`,
      method: 'post',
      data
    })
  },
  // 生成备库需求单
  demand(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/demand`,
      method: 'post',
      data,
      returnData: true
    })
  },
  // 根据备料计划生成合同
  addByPlan(data) {
    return request({
      url: `/v1/contract/contract/add-by-plan`,
      method: 'post',
      data
    })
  },
  // 导入审核备料计划
  import(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/import`,
      method: 'post',
      data
    })
  },
  // 统计
  total(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/total`,
      method: 'post',
      data
    })
  },
  // 批量退回
  back(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/batch-change-back`,
      method: 'post',
      data
    })
  },
  // 批量修改
  batch(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/batch-update`,
      method: 'post',
      data,
      returnData: true
    })
  },
  //批量编辑
  batch_plan(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/batch-edit`,
      method: 'post',
      data,
      returnData: true
    })
  },
  //批量作废
  batch_cancel(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/batch-cancel`,
      method: 'post',
      data,
      returnData: true
    })
  },
  // 手动完结
  batch_finish(data) {
    return request({
      url: `/v1/purchase-plan/purchase-plan/complete-hand`,
      method: 'post',
      data,
      returnData: true
    })
  },  
}
